# Contributor: Mohd Syazli Mahmud <syazli7@yahoo.com>
pkgname=mythplugins
pkgver=0.21.1
pkgrel=1
pkgdesc="MythTV Plugins Package. Includes mostly used plugins"
arch=('i686' 'x86_64')
url="http://svn.mythtv.org/trac/"
source=()
depends=('bash' 'mysql-clients>=5.0' 'qt3' 'lame' 'ffmpeg' 'libxvmc' 'mythtv' 'libcdaudio' \
	'libid3tag' 'libmad' 'libvorbis' 'flac' 'libcdaudio' 'cdparanoia' 'fftw2' 'sdl' 'faad2' 'taglib')
license=(GPL)
groups=(pvr)
options=()
md5sums=()

build() {
  [ "$CARCH" = "i686"   ] && ARCH="i686"
  [ "$CARCH" = "x86_64" ] && ARCH="x86-64"

    msg "Starting make..."

#    cp $startdir/aacdecoder.cpp $startdir/src/mythplugins/mythmusic/mythmusic/

    ##Start build
    rm -Rf $startdir/src/$pkgname
    mkdir -p $startdir/src
    cp $startdir/${pkgname}-${pkgver}.tar.bz2 $startdir/src
    cd $startdir/src
    tar -jxf ${pkgname}-${pkgver}.tar.bz2
    rm ${pkgname}-${pkgver}.tar.bz2
    cd $startdir/src/$pkgname

./configure --prefix=/usr --disable-opengl --disable-mytharchive \
--disable-create-dvd --disable-create-archive --disable-mythbrowser \
--disable-mythcontrols --disable-mythflix --enable-mythgallery --disable-exif \
--disable-new-exif --disable-mythgame --enable-mythmusic --enable-libvisual \
--enable-fftw --enable-sdl --enable-aac --enable-mythnews --disable-mythphone \
--disable-festival \--enable-mythvideo --disable-mythweather \
--enable-mythzoneminder --disable-mythmovies

    cd $startdir/src/$pkgname/mythvodka/mythvodka
    rm -f Makefile
    cd $startdir/src/$pkgname/mythvodka
    qmake mythvodka.pro || return 1
    cd $startdir/src/$pkgname/mythboinc
    qmake mythboinc.pro || return 1
    cd $startdir/src/$pkgname
    qmake mythplugins.pro || return 1

    cd $startdir/src/$pkgname/mythvodka
    make || return 1
    cd $startdir/src/$pkgname/mythboinc
    make || return 1
    cd $startdir/src/$pkgname
    make || return 1

    make INSTALL_ROOT=$startdir/pkg install || return 1
    cd $startdir/src/$pkgname/mythvodka
    make INSTALL_ROOT=$startdir/pkg install || return 1
    cd $startdir/src/$pkgname/mythvodka/scripts
    chmod a+x $startdir/src/$pkgname/mythvodka/scripts/*
    cp -p $startdir/src/$pkgname/mythvodka/scripts/* /usr/local/bin/
    wget http://www.linuxcentre.net/get_iplayer/get_iplayer
    chmod a+x $startdir/src/$pkgname/mythvodka/scripts/get_iplayer
    cp -p $startdir/src/$pkgname/mythvodka/scripts/get_iplayer /usr/local/bin/
    cd $startdir/src/$pkgname/mythvodka/rtmpdump
    make || return 1
    cp -p $startdir/src/$pkgname/mythvodka/rtmpdump /usr/local/bin/
    chmod a+rwx /var/tmp /var/log/mythtv
    cd $startdir/src/$pkgname/mythboinc
    make INSTALL_ROOT=$startdir/pkg install || return 1
    cd $startdir

#    rm -Rf $startdir/src/$pkgname
        }
